package com.zhongxi.guoyuan.view.seller;

import android.view.View;
import android.widget.ImageView;
import android.widget.MediaController;
import android.widget.RelativeLayout;

import com.bumptech.glide.Glide;
import com.zhongxi.guoyuan.R;
import com.zhongxi.guoyuan.application.MyApplication;
import com.zhongxi.guoyuan.base.BaseActivity;
import com.zhongxi.guoyuan.view.MainHomeActivity;

import java.io.IOException;

import pl.droidsonroids.gif.GifDrawable;
import pl.droidsonroids.gif.GifImageView;

public class SellerCenterActivity extends BaseActivity implements View.OnClickListener {

    private RelativeLayout relaRewardCoin;
    private RelativeLayout relaBeautifulStore;
    private RelativeLayout rl_meidou;
    private RelativeLayout rl_offline;

    @Override
    protected void initView() {
        super.initView();
        setContentView(R.layout.activity_seller_center);
        initTitle();
        tvTitle.setText("商家中心");
        relaBeautifulStore = (RelativeLayout) findViewById(R.id.relaBeautifulStore);
        relaRewardCoin = (RelativeLayout) findViewById(R.id.relaRewardCoin);
        rl_meidou = (RelativeLayout) findViewById(R.id.rl_meidou);
        rl_offline = (RelativeLayout) findViewById(R.id.rl_offline);
    }

    @Override
    protected void initData() {
        super.initData();
    }

    @Override
    protected void initEvent() {
        super.initEvent();
        ivBack.setOnClickListener(this);
        relaBeautifulStore.setOnClickListener(this);
        relaRewardCoin.setOnClickListener(this);
        rl_meidou.setOnClickListener(this);
        rl_offline.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.ivBack:
                finish();
                startAct(MainHomeActivity.class);
                break;
            case R.id.relaBeautifulStore:
                if (null != MyApplication.getInstance().getBeautifulCredentials() && !"".equals(MyApplication.getInstance().getBeautifulCredentials())) {
                    startAct(SellerBeautifulStoreOrderActivity.class);
                } else {
                    startAct(SellerBeautifulStoreLoginActivity.class);
                }
                break;
            case R.id.relaRewardCoin:
                if (null != MyApplication.getInstance().getRewardCoinCredentials() && !"".equals(MyApplication.getInstance().getRewardCoinCredentials())) {
                    startAct(SellerRewardCoinActivity.class);
                } else {
                    startAct(SellerRewardLoginActivity.class);
                }
                break;
            case R.id.rl_meidou:
                if (null != MyApplication.getInstance().getMDChangeCredentials() && !"".equals(MyApplication.getInstance().getMDChangeCredentials())) {
                    startAct(SellerExchangeBeanActivity.class);
                } else {
                    startAct(SellerMDChangeLoginActivity.class);
                }
                break;
            case R.id.rl_offline:
                if (null != MyApplication.getInstance().getOffLineCredentials() && !"".equals(MyApplication.getInstance().getOffLineCredentials())) {
                    startAct(SellerOffLineActivity.class);
                } else {
                    startAct(SellerOffLineLoginActivity.class);
                }
                break;
        }
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        finish();
        startAct(MainHomeActivity.class);
    }
}
